package com.itheima.service.impl;

import com.itheima.domian.Student;
import com.itheima.mapper.StudentMapper;
import com.itheima.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;
    public Student login(Student student) throws IOException {
        Student mapper = studentMapper.find(student);
        if (mapper==null){
            System.out.println("请输入正确信息");
            return null;
        }
        return mapper;
    }


    public List<Student> findAll() throws IOException {
        List<Student> list = studentMapper.findAll();
        return list;
    }


    public Student findById(Integer cid) throws IOException {
        return studentMapper.findById(cid);
    }


    public void delete(int cid) throws IOException {
        studentMapper.delete(cid);
    }


    public void add(Student student) throws IOException {
        studentMapper.add(student);
    }


    public void update(Student student) throws IOException {
        studentMapper.update(student);
    }
}
